zeek48.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Variables,Data-Types and Operators</title>
<script>
var a=10;
var b="Harry";
c=34.55;
console.log(c)
c=-c;
console.log(c)
a=a+20;
console.log(a)
// Operators in JavaScript
// In 3+4 '+' is the operator and 3,4 are operands.
// 1- unary operator- It has single operand for ex:(x = -x)
// Examples of unary operator
// c = -c;
// console.log(c)
// 2-binary operator- It has two operand for ex:(a = a+20)
// Examples of binary operator
// a = a+20;
// console.log(a)
// Arthimetic operators in action in Javascript
var num1=563;
var num2=402;
console.log("The value of num1+num2 is: "+ (num1+num2))
console.log("The value of num1-num2 is: "+ (num1-num2))
console.log("The value of num1*num2 is: "+ (num1*num2))
console.log("The value of num1/num2 is: "+ (num1/num2))
// Exponential operators in Javascript
var num3=2;
var num4=5;
console.log("The value of num3 to the power num4 is: "+ (num3**num4))
// Increment and decrement in Javascript
console.log("The value of num3++ is: "+ (num3++))
// This first gives value then increase it therefore now num3 is 3 but prints 2.
console.log("The value of ++num3 is: "+ (++num3))
// This first gives increase then gives value therefore now num3 is (that is 3+1)4
and prints 4.
console.log("The value of num4-- is: "+ (num4--))
// This first gives value then decrese it therefore now num4 is 4 but prints 5.
console.log("The value of --num4 is: "+ (--num4))
// This first gives increase then gives value therefore now num4 is
(that is 4-1)3 and prints 3.
</script>
</head>
<body>
<p>This is my body .For JavaScript variables,data-structures and operators right
click on body.Click on inspect and go to console.</p>
</body>
</html>
Comments
Post a Comment